package liuwanghui.mapper;

import liuwanghui.dto.request.MarketQueryDTO;
import liuwanghui.dto.request.StockLogDTO;
import liuwanghui.pojo.Inventory;
import liuwanghui.pojo.Order;
import liuwanghui.pojo.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;

@Mapper
public interface ConsumerMapper {
    List<Product> findMarketProducts(MarketQueryDTO params);
    Product findProductById(@Param("id") Long id);
    void createOrder(Map<String, Object> orderInfo);
    void reduceStock(@Param("productId") Long productId, @Param("quantity") Integer quantity);
    Map<String, Object> getOrderStats(@Param("userId") Long userId, @Param("timeRange") String timeRange);
    Map<String, Object> getExpenseStats(@Param("userId") Long userId, @Param("timeRange") String timeRange);
    Map<String, Object> getFavoriteStats(@Param("userId") Long userId);
    List<Map<String, Object>> getCategoryStats(@Param("userId") Long userId, @Param("timeRange") String timeRange);
    Inventory findInventoryByProductId(@Param("productId") Long productId);
    void updateInventoryStock(Inventory inventory);
    void insertStockLog(StockLogDTO log);
    void insertOrder(Order order);
} 